﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Apache.Cassandra;

namespace Lucandra.Net.Convenience
{
    internal sealed class SuperColumnMutation
    {
        Mutation mutation;

        public IList<Column> Columns
        {
            get { return this.mutation.Column_or_supercolumn.Super_column.Columns; }
        }

        public SuperColumnMutation(string superColumnName)
        {
            this.mutation = new Mutation()
            {
                Column_or_supercolumn = new ColumnOrSuperColumn()
                {
                    Super_column = new SuperColumn()
                    {
                        Name = Encoding.UTF8.GetBytes(superColumnName),
                        Columns = new List<Column>()
                    }
                }
            };
        }

        public static implicit operator Mutation(SuperColumnMutation mut)
        {
            return mut.mutation;
        }
    }
}
